<?php 
namespace Home\Controller;
use Frame\Libs\BaseController;
use Admin\Model\NewsModel;
use Admin\Model\yewuModel;
use Admin\Model\ImagesModel;
use Admin\Model\BottomModel;

final class IndexController extends BaseController{
	public function index(){
		$new_data = NewsModel::getInstance()->fetchAll();

		$images_data = ImagesModel::getInstance()->fetchAll();
		
		$yewu_data = YewuModel::getInstance()->fetchAll();
		
		$bottom_data = BottomModel::getInstance()->fetchOne();
		$bottom_data = str_replace(",","<br>",$bottom_data);
		
		$this->smarty->assign([
				"new_data"   => $new_data,
				"yewu_data"  => $yewu_data,
				"images_data"=>$images_data,
				"bottom_data"=>$bottom_data,
		]);
		$this->smarty->display("index/index.html");
	}
	public function news(){
		$id = $_GET["id"];
		$yewu_data = NewsModel::getInstance()->fetchOne("id=$id");
		die($yewu_data["content"]);
	}
	public function yewu(){
		$id = $_GET["id"];
		$yewu_data = YewuModel::getInstance()->fetchOne("id=$id");
		die($yewu_data["content"]);
	}
	public function test(){
		$this->smarty->display("index/test.html");
	}
}


